import React, { Component } from 'react';
import { connect } from 'react-redux'
class Home extends Component {
  render () {
    console.log('Home:', this.props)
    let { isKaoShi } = this.props.student
    return (
      <div>
        Home
        <span>{ isKaoShi ? '已经考试完': '没有参加该课程的考试'}</span>
        <button onClick={() => this.props.dispatch({
          type: 'KAO_SHI', payload: {time: '2hours', course: '化学'}})}>发送数据</button>
      </div>
    )
  }
}

export default connect(state => {
  return {
    student: state.studentReducer
  }
})(Home)
